<?php
/*
 *	DreamArticle Version3.0
 *	Copyright 2007-2008, iDreamSoft
 *	http://www.idreamsoft.cn
 *	By:coolmoo<idreamsoft@qq.com>
*/
require_once("global.php");
require_once("include/template.fun.php");
$do=$_GET['do'];
if(!$do){
	$DreamCMS->message();
}elseif($do=='post'){
	if($_POST['action']=='save'){
		checkverifycode(trim($_POST['chk']),$DreamCMS->language('error:seccode'),message);
		$user=array();
		$user["name"]=htmlspecialchars($_POST['name']);
	    $user["m"]=intval($_POST['m']);
	    $user["email"]=htmlspecialchars($_POST['mail']);
	    $user["homepage"]=$_POST['homepage']=='http://'?'':htmlspecialchars($_POST['homepage']);
	    $secret=$_POST['secret'];
	    $messagetext=htmlspecialchars($_POST['messagetext']);
		!eregi("^([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([a-z]{2,6})$",$user["email"])&&alert($DreamCMS->language('error:email'));
		!$messagetext && alert($DreamCMS->language('message:empty'));
		$userdate=serialize($user);
		!$secret&&$secret='off';
		$DreamCMS->db->query("INSERT INTO `#DC@__message`(`user`,`text`,`reply`,`secret`,`addtime`,`ip`)VALUES ('$userdate','$messagetext','','$secret','".time()."','".getip()."')");
		alert($DreamCMS->language('message:finish'),'url:1');
	}
}
?>